Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add eTRV Monitoring, Maintenance Dropdown, and Boiler Automation Support #98

Open
wants to merge 10 commits into
base: develop
Choose a base branch
from

Conversation

genestealer
Copy link
Contributor

@genestealer genestealer commented Dec 27, 2024

Summary

Added improved monitoring and integration for eTRVs. Key features: valve state monitoring, dropdown for maintenance commands and boiler automation support.

Changes Introduced

  1. eTRV 'TEMPERATURE' Monitoring: Add Heat_Demanded sensor to eTRV #96
  • Added logic to determine and publish the heating state (heating or idle) based on room temperature and set-point.
  • Aligns with Home Assistant's HVACAction enum for accurate state reporting.
  1. Dropdown for Maintenance Commands: Add dropdown to climate control dashboard card for most used maintainance operations for eTRV #90
  • Integrated a dropdown menu for common maintenance operations (e.g., Exercise Valve, Request Diagnostics) in the Home Assistant dashboard using the 2023.9+ option feature.
  1. Parameter Renaming: Rename (SET_)REPORTING_INTERVAL to REPORT_PERIOD #72
  • Updated SET_REPORTING_INTERVAL to REPORT_PERIOD
  1. State Class for Long-Term Statistics: Enable long-term statistics in home assistant #68
  • Added state_class to sensors for historical data tracking in Home Assistant.
  1. Boiler Automation Support: Link underlying heating/boiler 'state' to the state of eTRV #91
  • Enhanced valve state reporting (open/closed and calling for heat) for integration with boiler controls.

Why This Matters

These changes improve usability by making eTRV states and maintenance actions accessible directly from Home Assistant.

Files Updated

  1. 3.json: Heating state logic, maintenance commands dropdown, parameter renaming.
  2. app.js: Heating state calculation, parameter updates.
  3. README.md: Updated documentation for new features.
  4. 1.json, 2.json, 4.json, 5.json: Added state_class.

Example MQTT climate discovery message

{
  "uniq_id": "ener314rt-4329-Climate_Control",
  "device": {
    "name": "Radiator 4329",
    "ids": [
      "ener314rt-4329"
    ],
    "mdl": "Radiator (MIHO013) [4329]",
    "mf": "Energenie",
    "sw": "mqtt-ener314rt v0.7.2",
    "via_device": "mqtt-energenie-ener314rt"
  },
  "~": "energenie/3/4329/",
  "name": null,
  "avty_t": "energenie/availability/state",
  "o": {
    "name": "mqtt-energenie-ener314rt",
    "sw": "v0.7.2",
    "url": "https://github.com/Achronite/mqtt-energenie-ener314rt"
  },
  "curr_temp_t": "~TEMPERATURE/state",
  "max_temp": 40,
  "min_temp": 5,
  "modes": [
    "heat"
  ],
  "mode_cmd_t": "~VALVE_STATE/command",
  "mode_stat_t": "~VALVE_STATE/state",
  "mode_cmd_tpl": "{% if value == 'off' %} 1 {% else %} 2 {% endif %}",
  "mode_stat_tpl": "{% if value == '1' %} off {% else %} heat {% endif %}",
  "temp_cmd_t": "~TARGET_TEMP/command",
  "temp_stat_t": "~TARGET_TEMP/state",
  "ic": "mdi:radiator",
  "opt": "true",
  "temp_step": "0.5",
  "temp_unit": "C",
  "act_tpl": "{% if value == 'ON' %} heating {% else %} idle {% endif %}",
  "act_t": "~HVAC_ACTION/state",
  "pr_mode_cmd_t": "~Maintenance/command",
  "pr_mode_stat_t": "~Maintenance/state",
  "pr_modes": [
    "Cancel Command",
    "Request Diagnostics",
    "Request Voltage",
    "Exercise Valve",
    "Identify",
    "Low Power Mode ON",
    "Low Power Mode OFF",
    "Valve Auto",
    "Valve Open",
    "Valve Closed"
  ]
}

How it looks:

image
image
image
image
image
image
image
image

@genestealer
Copy link
Contributor Author

Also added Add dropdown to climate control dashboard card for most used maintainance operations for eTRV
#90
image

@genestealer genestealer marked this pull request as ready for review December 27, 2024 12:40
@genestealer genestealer marked this pull request as draft December 27, 2024 12:42
@genestealer genestealer marked this pull request as ready for review December 27, 2024 19:38
@genestealer genestealer changed the title Added code to process eTRV 'TEMPERATURE' OpenThings monitor message Add eTRV Monitoring, Maintenance Dropdown, and Boiler Automation Support Dec 27, 2024
@genestealer genestealer changed the base branch from master to develop December 27, 2024 19:49
@@ -325,7 +325,7 @@ Both MiHome heating devices are now supported (as of v0.7.x). Specifically the
These devices are battery operated, so energenie in order to save power, have implemented periods of sleep where the devices do not listen for commands. This can lead to a delay from when a command is sent to it being processed by the device. See **Command Caching** below.

### Command Caching
Battery powered energenie devices, such as the eTRV or Thermostat do not constantly listen for commands. For example, the eTRV reports its temperature at the *SET_REPORTING_INTERVAL* (default 5 minutes) after which the receiver is then activated to listen for commands. The receiver only remains active for 200ms or until a message is received.
Battery powered energenie devices, such as the eTRV or Thermostat do not constantly listen for commands. For example, the eTRV reports its temperature at the *SET_REPORT_PERIOD* (default 5 minutes) after which the receiver is then activated to listen for commands. The receiver only remains active for 200ms or until a message is received.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change to REPORT_PERIOD (remove SET)

@Achronite
Copy link
Owner

Sorry for the delay, with Christmas and all that!

I'm not entirely sure about the use of cached temperature and setting of state to show 'heating' or not; surely this is also reliant upon if the boiler has the house heating on or not?

I must apologise though; I modified my code to add 'auto' on my climate nodes quite a while back, after installing the Drayton Wiser system and observing what it did; I just hadn't pushed them to 'develop' yet.

3.json:

      {
         "id": "Climate_Control",
         "component": "climate",
         "main": true,
         "config": {
            "curr_temp_t": "~TEMPERATURE/state",
            "max_temp": 40,
            "min_temp": 5,
            "modes": [
               "auto",
               "heat",
               "off"
            ],
            "mode_cmd_t": "~VALVE_STATE/command",
            "mode_stat_t": "~VALVE_STATE/state",
            "mode_cmd_tpl": "{% if value == 'off' %} 1 {% elif value == 'auto' %} 2 {% else %} 0 {% endif %}",
            "mode_stat_tpl": "{% if value == '1' %} off {% elif value == '2' %} auto {% else %} heat {% endif %}",
            "temp_cmd_t": "~TARGET_TEMP/command",
            "temp_stat_t": "~TARGET_TEMP/state",
            "ic": "mdi:radiator",
            "opt": "true",
            "temp_step": "0.5",
            "act_tpl": "{% if value == 'Off' %} off {% else %} heating {% endif %}",
            "act_t": "heating/state"
         }

I also added an automation to set the 'heating' status for auto mode based on the boiler state using MQTT from within HA:
image

I'll push the changes I made to develop now.

@genestealer
Copy link
Contributor Author

Hi @Achronite,

I'm not entirely sure about the use of cached temperature and setting of state to show 'heating' or not; surely this is also reliant upon if the boiler has the house heating on or not?

The valve action state (heating/idle) for each valve is designed to be independent of external factors, including other valves and the heat source/boiler. This approach aligns with how other MQTT radiator valve integrations work. The retained temperature set-point in MQTT is used as it is reliably set by the app.js code when the valve is commanded to a new target temperature. This ensures consistent state determination for each valve.

I must apologise though; I modified my code to add 'auto' on my climate nodes quite a while back, after installing the Drayton Wiser system and observing what it did; I just hadn't pushed them to 'develop' yet.

The "auto" mode is not suitable for the Energenie eTRVs because these valves do not have a stored schedule. According to Home Assistant’s climate documentation, "Auto: The device is set to a schedule, learned behavior, AI." I removed all options except "heat" to simplify functionality and avoid confusion.

Including "off" can also be misleading, as it suggests "valve closed," but without command caching, this could cause issues. For example:

  • If the mode is set to "heat" and then a target temperature is changed, the new target temperature will override the mode. This could result in the valve staying closed (off) while appearing to be set to "heat," leading to inconsistent behavior.

I also added an automation to set the 'heating' status for auto mode based on the boiler state using MQTT from within HA:

If I understand correctly, this means setting all valve states to heating whenever the boiler is on, regardless of whether individual valves are "calling for heat" (i.e., the set-point temperature is higher than the current room temperature). This is an interesting approach and could be useful to ensure coordination between the boiler and valves. However, it diverges from the idea of each valve independently reporting its own status. Allowing valves to reflect their individual heating or idle state independently might offer more granular control, while additional logic for boiler coordination could live in Home Assistant automations.

@genestealer
Copy link
Contributor Author

@Achronite
Please note, according to Home Assistant’s climate documentation, the HVAC action (act_tpl) you have used is 'heating' & 'off' but I think you should have used 'idle' rather than 'off' see documentation.

The HVAC action describes the current action. This is different from the mode, because if a device is set to heat, and the target temperature is already achieved, the device will not be actively heating anymore.

@Achronite
Copy link
Owner

@Achronite
Please note, according to Home Assistant’s climate documentation, the HVAC action (act_tpl) you have used is 'heating' & 'off' but I think you should have used 'idle' rather than 'off' see documentation.

The HVAC action describes the current action. This is different from the mode, because if a device is set to heat, and the target temperature is already achieved, the device will not be actively heating anymore.

Ok.

@genestealer
Copy link
Contributor Author

Hello @Achronite

This is now tested and ready to go 😊

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants